﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PCR.Logic
{
    using PCR.Base;

    /// <summary>
    /// Object factory class, the objects the caller need are all created here
    /// in order to make the UI or other outside module do not know the classs
    /// detail information
    /// </summary>
    public class ObjectFactory
    {
        /// <summary>
        /// Create the specified object type
        /// </summary>
        /// <param name="objType">The object type to create</param>
        /// <returns>NULL, if not support</returns>
        public static object CreateObject(ObjectType objType)
        {
            object obj = null;
            switch(objType)
            {
                case ObjectType.PatientReport:
                    obj = new PatientReport();break;
                case ObjectType.PatientVirus:
                    obj = new PatientVirus();break;
                case ObjectType.StdSampleData:
                    obj = new StdSampleData();break;
                case ObjectType.StdCurve:
                    obj = new StdCurve();break;
                case ObjectType.VirusType:
                    obj = new VirusType();break;
                default:
                    System.Diagnostics.Debug.Assert(false, 
                        string.Format("Object type not supported : {0}", objType.ToString()));
                    
                    throw new NotSupportedException(
                        string.Format("Object type not supported : {0}", objType.ToString()));
            }

            return obj;
        }

    }
}
